package com.htthorizon.system.api;

import com.htthorizon.system.api.domain.MonitorAll;
import com.htthorizon.system.api.factory.RemoteUserFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
import com.htthorizon.common.core.constant.SecurityConstants;
import com.htthorizon.common.core.constant.ServiceNameConstants;
import com.htthorizon.common.core.domain.R;
import com.htthorizon.system.api.domain.SysUser;

import com.htthorizon.system.api.model.LoginUser;

import java.util.List;

/**
 * 用户服务
 * 
 * @author mark
 */
@FeignClient(contextId = "remoteUserService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteUserFallbackFactory.class)
public interface RemoteUserService
{
    /**
     * 通过用户名查询用户信息
     *
     * @param username 用户名
     * @param source 请求来源
     * @return 结果
     */
    @RequestMapping(value = "/user/info/{username}",method = RequestMethod.GET)
    public R<LoginUser> getUserInfo(@PathVariable("username") String username, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    /**
     * 注册用户信息
     *
     * @param sysUser 用户信息
     * @param source 请求来源
     * @return 结果
     */
    @RequestMapping(value = "/user/register", method = RequestMethod.POST)
    public R<Boolean> registerUserInfo(@RequestBody SysUser sysUser, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
    @RequestMapping(value = "/user/getById",method = RequestMethod.POST)
    SysUser getUserById(@RequestParam("sysUserId") Long sysUserId);
    @RequestMapping(value = "/dept/getDepts",method = RequestMethod.POST)
    List<String> getDeptList();
    @RequestMapping(value = "/user/addUserByUserName",method = RequestMethod.GET)
    R<Boolean> addUserByUserName(@RequestParam("user") String user);

    @RequestMapping(value = "/monitor/all",method = RequestMethod.GET)
    R<MonitorAll> all();
}
